<template>
  <div class="wrapper">
      <!-- <div id="example-container" class="wrapper"> -->
      <HotTable :root="Config.root" :settings="Config.hotSettings"></HotTable>
    <!-- </div> -->
    <div id="Config.root"></div>
  </div>

</template>
<script>
import moment from "moment"; //引入handsontable依赖的插件
import numbro from "numbro";
import pikaday from "pikaday"; //日期插件
// import Zeroclipboard from 'zeroclipboard';
import Handsontable from "handsontable";
import HotTable from "%/template/HotTable";
import Vue from "vue";
import Config from "#/js/hotTabelconfig.js";

export default {
  data: function() {
    let me = "刘焱";
    return { Config };
  },
  name: "SampleApp",
  mounted() {
    Config.temp.ignore = true;
    this.loading();
  },
  methods: {
    loading() {
      let eid = this.$route.params.eid;
      this.$http({
        url: "excel_getExcelContent",
        params: {
          "excel.eid": eid
        }
      })
        .then(re => {
          let data = re.body.item;
          if (re.body.item.length==0) {
            data = [[null, 0, 0]];
            Config.temp.ignore = false;
          }
          let edata = new Array();
          for (let i = 0; i < data.length; i++) {
            let item = [data[i][2], data[i][1], data[i][0]];
            edata.push(item);
          }
          Config.temp.table.setDataAtCell(edata);
        })
        .catch(re => {
          this.$Message.error("获取表格数据失败,请刷新重试!");
        });
    }
  },
  components: {
    HotTable
  }
};
</script>

<style lang="less">
.button {
  margin: 20px 20px;
}
.handsontable .currentRow {
  background-color: #e7e8ef;
}
.handsontable .currentCol {
  background-color: #f9f9fb;
}
#test-hot.handsontable {
  height: 600px;
  width: 100%;
}
// #test-hot {
//   width: 800px;
//   height: 800px;
//   overflow: hidden;
// }
</style>